class CreateItems < ActiveRecord::Migration
  def self.up
    create_table :items do |t|
      t.column "code", :int, :null => false
      t.column "passage_id", :int
      t.column "question", :text, :null => false
      t.column "a", :string
      t.column "b", :string
      t.column "c", :string
      t.column "d", :string
      t.column "e", :string
      t.column "answer", :char, :null => false
      t.column "choice_counter", :int, :null => false, :default => 4
      
      t.column "skill_id", :int, :null => false
      t.column "subskill_id", :int, :null => false
      t.column "category_id", :int, :null => false
      t.column "topic_id", :int, :null => false
      t.column "subtopic_id", :int, :null => false
      t.column "difficulty_id", :int, :null => false
      t.column "partcode_id", :int, :null => false
      
      t.column "irt_a", :float
      t.column "irt_b", :float
      t.column "irt_c", :float
      
      t.timestamps
    end
    
    add_index :items, :code, :name => 'items_code'
    add_index :items, :passage_id, :name => 'items_passage_id'
  end

  def self.down
    drop_table :items
  end
end